package com.huatai.exchange.utils;

import com.faneui.common.exception.BusinessException;
import com.huatai.exchange.cache.FileLoadInfoCache;
import com.huatai.exchange.dal.model.ExcFileLoadRecord;
import com.huatai.exchange.service.ExcFileLoadRecordService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class FileLoadUtils {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private ExcFileLoadRecordService fileLoadRecordService;

    public String checkFileIsLoad(String id, String occurDate) throws BusinessException {
        ExcFileLoadRecord record = fileLoadRecordService.queryExcFileLoadRecord(id, occurDate);
        return record != null ? "1" :( "文件[" + FileLoadInfoCache.loadFileNameCache.get(id) + "]日期[" + occurDate + "]的文件未加载");
    }


}
